<!DOCTYPE html>
<html>
	<head>
		<title>Editors. Bind Form</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
	</head>
	<body>
		<div class='sample_comment'> Bind form:</div>
		<div id="testA" style='width:800px'></div>
	
		
		<script type="text/javascript" charset="utf-8">

		webix.ready(function(){

			var grid = {
				view:"datatable", id:"datatable1",
				columns:[
					{ id:"id",							header:"", css:"rank",  		width:50},
					{ id:"title",	editor:"text",		header:"Film title",width:200},
					{ id:"start",	editor:"popup",		header:"Text A",	width:120},
					{ id:"end",		editor:"popup",		header:"Text B", 	width:120}
				],
				
				select:true,
				autoheight:true,
				autowidth:true,

				data: [
					{ id:1, title:"The Shawshank Redemption", start:"Some pretty long text here and there, here and there", end:"Short text" },
					{ id:2, title:"The Godfather", start:"", end:"" }
				]
			};

			var form = {
				view:"form", id:"form1", scroll:false,
				elements:[
					{ view:"text", name:"title", label:"Title" },
					{ view:"textarea", name:"start", label:"Text A" },
					{ view:"textarea", name:"end", label:"Text B" },

					{ view:"button", value:"Save", click:'$$("form1").save()' }
				]
			};

			webix.ui({ 
				container:"testA",
				type:"wide",
				cols:[ grid, form ]
			});

			$$('form1').bind('datatable1')
					
		});

		</script>
	</body>
</html>,